package com.flyco.modules.stm.entity;

import java.io.Serializable;
import java.util.Date;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.flyco.common.aspect.annotation.Dict;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

/**
 * @Description: 门店要货单
 * @Author: flyco
 * @Date:   2020-11-23
 * @Version: V1.0
 */
@Data
@TableName("stm_replenishment")
@ApiModel(value="stm_replenishment对象", description="门店要货单")
public class StmReplenishment implements Serializable {
    private static final long serialVersionUID = 1L;
    
	/**id*/
	@TableId(type = IdType.AUTO)
	@JsonSerialize(using= ToStringSerializer.class)
    @ApiModelProperty(value = "id")
	private Long id;

	/**店铺id*/
	@ApiModelProperty(value = "商家id")
	private Long partnerId;

	/**店铺id*/
    @ApiModelProperty(value = "店铺id")
	private Long storeId;

	@ApiModelProperty(value = "店铺id")
	private String storeName;

	/**补货单编号*/
    @ApiModelProperty(value = "补货单编号")
	private String replenishmentSn;
	/**订单状态(0：已创建，1：已提交，3：审核，4:已取消，5：已发货，6：已收货，7：已完成)*/
    @ApiModelProperty(value = "订单状态(0：已创建，1：已提交，3：审核，4:已取消，5：已发货，6：已收货，7：已完成)")
	@Dict(dicCode = "replenishment_status")
	private Integer status;
	/**生成调拨单标识*/
	@ApiModelProperty(value = "生成调拨单标识")
	@Dict(dicCode = "yn")
	private Integer transferFlag;
	/**创建人id*/
    @ApiModelProperty(value = "创建人id")
	private Long createSalesId;
	/**创建人*/
    @ApiModelProperty(value = "创建人")
	private String createSales;
	/**审核ID*/
    @ApiModelProperty(value = "审核ID")
	private Long confirmSalesId;
	/**审核人*/
    @ApiModelProperty(value = "审核人")
	private String confirmSales;
	/**审核通过时间*/
	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "审核通过时间")
	private Date confirmTime;
	/**取消人ID*/
    @ApiModelProperty(value = "取消人ID")
	private Long cancelSalesId;
	/**取消人*/
    @ApiModelProperty(value = "取消人")
	private String cancelSales;
	/**取消时间*/
	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "取消时间")
	private Date cancelTime;
	/**创建人*/
    @ApiModelProperty(value = "创建人")
	private String createBy;
	/**创建时间*/
	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "创建时间")
	private Date createTime;
	/**更新人*/
    @ApiModelProperty(value = "更新人")
	private String updateBy;
	/**更新时间*/
	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "更新时间")
	private Date updateTime;

	private Integer version;

	private String sapAddressCode;

	/**采购执行时间*/
	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
	@ApiModelProperty(value = "采购执行时间")
	@TableField(updateStrategy = FieldStrategy.IGNORED)
	private Date execTime;

	/**店铺名称*/
	@TableField(exist = false)
	private String storeId_dictText;

	@TableField(exist = false)
	private String status_dictText;

	//0：已创建，1：已提交，3：已审核，4:已取消，7：已完成
	public void setStatusDictText() {
		switch(status){
			case 1:
				status_dictText =  "待推送";
				return;
			case 4:
				status_dictText = "已取消";
				return;
			case 3:
				status_dictText = "待发货";
				return;
			case 5:
				status_dictText = "待收货";
				return;
			case 7:
				status_dictText = "已完成";
				return;
			default:
				status_dictText = "未知状态"+status;
		}
	}
}
